#!/bin/bash

DIR="$( cd "$( dirname "$0" )" && pwd )"

SSH_OPTS='-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'

source $DIR/experiment-variables.sh
source $DIR/env.sh

INSTALLCMD='sudo apt-get update ; nohup sudo apt-get -y install openjdk-6-jdk > /dev/null 2> /dev/null < /dev/null &'

echo "nodes: $NODES"

echo "Installing java on $MAINSERVER"
ssh $SSH_OPTS -i $SSH_KEY $USER@$MAINSERVER "$INSTALLCMD"

for node in $NODES; do
	echo "Installing java on $node"
	ssh $SSH_OPTS -i $SSH_KEY $USER@$node "$INSTALLCMD"
done


for client in $JMETERCLIENT; do
	echo "Installing java on $client"
	ssh $SSH_OPTS -i $SSH_KEY $USER@$client "$INSTALLCMD"
done


